<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            position: relative;
            /* width: ; */
        }

        .img {
            position: absolute;
            width: 98px;
            height: 200px;
            background: url(./img/2.jpg)no-repeat;
            background-position: 1px 0;
            margin: auto;
            z-index: 2;
        }

        .img-1 {
            position: absolute;
            width: 98px;
            height: 200px;
            background: url(./img/2.jpg)no-repeat;
            background-position: -14900px 0;
            margin: auto;
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="img"></div>

    </div>
    <script src="./jquery-3.6.0.js"></script>
    <script>
        var time
        var a = 0
        var isok = true

        $('.img').click(function () {
            if (isok) {
                isok = false
                time = setInterval(function () {
                    if (a > -13480) {
                        a = a - 98
                        $('.img').css('backgroundPosition', a)
                    } else {
                        clearInterval(time)
                        isok = true
                        a = 0
                    }
                }, 50)
            }
        })



    </script>
</body>

</html>